package com.gui.windows.components;

import javax.swing.JPanel;

import org.jdesktop.layout.GroupLayout;

import com.gui.GUIComponent;
import com.gui.windows.Sizes;
import com.gui.windows.UserActions;

public abstract class GenericPanel extends JPanel implements GUIComponent, UserActions, Sizes {

	//**************************************************************************************************
	//	Constructor.
	//**************************************************************************************************	
	
	public GenericPanel() {
		super();
	}

	//**************************************************************************************************
	//	Attributes.
	//**************************************************************************************************	
	
	private static final long serialVersionUID = 1L;

	/** The main window layout */
	protected GroupLayout layout;

	//**************************************************************************************************
	//	Methods.
	//**************************************************************************************************	
	
	public void create() {
		initComponents();
		setLayout();
		addComponents();
	}
	
	/**
	 * Initialize all the components that are going to be contained by the main window.
	 * */
	protected abstract void initComponents ();

	/**
	 * Adds the components to the main window.
	 * */
	protected abstract void addComponents();
	
	/**
	 * Sets the layout of the main window.
	 * */
	protected void setLayout() {
		layout = new GroupLayout(this);
		this.setLayout(layout);
		layout.setAutocreateGaps(true);
		layout.setAutocreateContainerGaps(true);
	}
}
